﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Toetoe.Models.Domain.Bericht>>" %>
<%@ Import Namespace="Toetoe.Models.Domain" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="headContent" runat="server">
 
    <script type="text/javascript">
        $(document).ready(function () {
            //wire up to the form submit event
            $("form").submit(function (event) {
                event.preventDefault();  //prevent the actual form post
                hijack(this, update, "html"); //send ajax request to server
            });
        });

        function hijack(form, callback, format) {
            $.ajax({
                url: form.action,
                type: form.method,
                dataType: format,
                data: $(form).serialize(),
                success: callback
            });
        }

        function update(result) {
            $("#berichtenlijst").html(result);
        }    
    </script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Gastenboek</h2>

    <div id="toevoegen">
        <% Html.RenderPartial("Create", new Bericht()); %>
    </div>

    <div id="berichtenlijst">
        <% Html.RenderPartial("BerichtenLijst", Model); %>
    </div>

</asp:Content>

